/*
 * Copyright (C) 2011 TargetBoard
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package jaxb.wrappers;

import contrl.model.data.table.Column;

/**
 * @author amc
 *
 */
public class ColumnWrapper implements Column {
	private jaxb.generated.datatable.Column column;

	public ColumnWrapper(jaxb.generated.datatable.Column column) {
		this.column = column;
	}

	public ColumnWrapper(String content, boolean key, boolean required) {
		column = new jaxb.generated.datatable.Column();
		column.setContent(content);
		column.setKey(key);
		column.setRequired(required);
	}

	public String getContent() {
		return column.getContent();
	}

	@Override
	public boolean isKey() {
		if (column.isKey() != null) {
			return column.isKey();
		} else {
			return false;
		}

	}

	@Override
	public boolean isRequired() {
		if (column.isRequired() != null) {
			return column.isRequired();
		} else {
			return false;
		}
	}

	@Override
	public void setContent(String value) {
		column.setContent(value);
	}

	@Override
	public void setKey(boolean value) {
		column.setKey(value);
	}

	@Override
	public void setRequired(boolean value) {
		setRequired(value);
	}
}
